package com.ruoyi.loan.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.loan.mapper.TbPeriodsMapper;
import com.ruoyi.loan.domain.TbPeriods;
import com.ruoyi.loan.service.ITbPeriodsService;

/**
 * 期数Service业务层处理
 * 
 * @author jy
 * @date 2023-01-14
 */
@Service
public class TbPeriodsServiceImpl implements ITbPeriodsService 
{
    @Autowired
    private TbPeriodsMapper tbPeriodsMapper;

    /**
     * 查询期数
     * 
     * @param periodsId 期数主键
     * @return 期数
     */
    @Override
    public TbPeriods selectTbPeriodsByPeriodsId(Long periodsId)
    {
        return tbPeriodsMapper.selectTbPeriodsByPeriodsId(periodsId);
    }

    /**
     * 查询期数列表
     * 
     * @param tbPeriods 期数
     * @return 期数
     */
    @Override
    public List<TbPeriods> selectTbPeriodsList(TbPeriods tbPeriods)
    {
        return tbPeriodsMapper.selectTbPeriodsList(tbPeriods);
    }

    /**
     * 新增期数
     * 
     * @param tbPeriods 期数
     * @return 结果
     */
    @Override
    public int insertTbPeriods(TbPeriods tbPeriods)
    {
        tbPeriods.setCreateTime(DateUtils.getNowDate());
        return tbPeriodsMapper.insertTbPeriods(tbPeriods);
    }

    /**
     * 修改期数
     * 
     * @param tbPeriods 期数
     * @return 结果
     */
    @Override
    public int updateTbPeriods(TbPeriods tbPeriods)
    {
        tbPeriods.setUpdateTime(DateUtils.getNowDate());
        return tbPeriodsMapper.updateTbPeriods(tbPeriods);
    }

    /**
     * 批量删除期数
     * 
     * @param periodsIds 需要删除的期数主键
     * @return 结果
     */
    @Override
    public int deleteTbPeriodsByPeriodsIds(Long[] periodsIds)
    {
        return tbPeriodsMapper.deleteTbPeriodsByPeriodsIds(periodsIds);
    }

    /**
     * 删除期数信息
     * 
     * @param periodsId 期数主键
     * @return 结果
     */
    @Override
    public int deleteTbPeriodsByPeriodsId(Long periodsId)
    {
        return tbPeriodsMapper.deleteTbPeriodsByPeriodsId(periodsId);
    }
}
